/*
 * @Author: miteng 973203639@qq.com
 * @Date: 2023-12-21 09:19:21
 * @LastEditors: miteng 973203639@qq.com
 * @LastEditTime: 2024-07-09 14:04:19
 * @Description: 
 * Copyright (c) 2024-present HBIS Digital Technology Co.,Ltd. All rights reserved. 
 */
/**
 * window.sessionStorage 浏览器临时缓存
 */
export const sessionStorage = {
  // 设置临时缓存
  set(key: string, val: string | boolean | number | [] | null | undefined): void {
    window.sessionStorage.setItem(key, JSON.stringify(val));
  },
  // 获取临时缓存
  get(key: string): JSON {
    const json: string = window.sessionStorage.getItem(key) as string;
    return JSON.parse(json);
  },
  // 移除临时缓存
  remove(key: string): void {
    window.sessionStorage.removeItem(key);
  },
  // 移除全部临时缓存
  clear(): void {
    window.sessionStorage.clear();
  }
};
